/*
Author: Surpass-HC
Source: https://gitee.com/hxchuan000/clpc-1
Mail: surpass-hc@qq.com
*/
#ifndef __SYSTEM_TIMER_C_H__
#define __SYSTEM_TIMER_C_H__
#include <typecomm.h>
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_LINUX
// system timer type
typedef uint64_t sysTmTp;
#else
// system timer type
typedef uint32_t sysTmTp;
#endif
// get system time ms now.
sysTmTp sysTmNow();
// update system time ms!
void sysTmUp(sysTmTp runms);
// define system timer ms value.
#define sysTmDef(ctmName) sysTmTp ctmName
// system timer ms begin run!
#define sysTmBeg(ct) (ct = sysTmNow())
// define system timer ms value, and begin run
#define sysTmDefBeg(ctmName) sysTmTp ctmName = sysTmNow();
// calculate system timer run milliseconds
#define sysTmRunMs(ct) (sysTmNow() - ct)
// calculate system timer run seconds.
#define sysTmRunSec(ct) (sysTmRunMs(ct) / 1000)
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_LINUX
sysTmTp sysTnNow();
#endif

#endif
